

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
    <style>
    /* base */
    html,
    body,
    .container {
      width: 100%;
      height: 100%;
    }

    a,
    a:link,
    a:visited {
      text-decoration: none;
      color: inherit;
    }

    ul {
      list-style: none;
    }

    *,
    ::before,
    ::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    *:focus {
      outline: 0;
    }

    .container {
      display: flex;
      padding-top: 20px;
    }

    /* Nav */
    .container .doc-nav {
      position: fixed;
      height: 100%;
      margin: 0 30px 0 40px;
      width: 280px;
    }

    .doc-nav .nav-header {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      background-color: rgb(240, 241, 242);
      height: 40px;
      padding: 16px;
      font-size: 18px;
      font-weight: 500;
      color: rgb(62, 64, 66);
      cursor: pointer;
    }

    .doc-nav .nav-content {
      height: calc(100% - 40px);
      overflow-y: auto;
      color: rgb(32, 34, 36);
    }

    .doc-nav .nav-content .nav-list,
    .doc-nav .nav-content .nav-sub-list {
      line-height: 1.5rem;
    }

    .doc-nav .nav-content .nav-label {
      display: inline-block;
      position: relative;
      padding: 2px 0 2px 20px;
      margin-bottom: 4px;
    }

    .doc-nav .nav-content .nav-sub-label {
      position: relative;
      padding: 2px 0 2px 40px;
      font-size: 14px;
    }

    .doc-nav .nav-content .nav-sub-label:hover {
      text-decoration: underline;
    }

    .doc-nav .nav-content .nav-list .nav-label.group::before {
      border-bottom: 0.25rem solid transparent;
      border-left: 0.25rem solid #6e7072;
      border-right: 0;
      border-top: 0.25rem solid transparent;
      content: '';
      display: block;
      height: 0;
      left: 0.5rem;
      position: absolute;
      top: 0.625rem;
      transition: transform 0.1s linear;
      width: 0;
    }

    .doc-nav .nav-content .nav-list .nav-label.group.active::before {
      transform: rotate(90deg);
    }

    /* doc content */
    .container .doc-content {
      position: fixed;
      height: 100%;
      width: calc(100% - 80px - 40px - 30px - 240px);
      right: 0%;
      overflow-y: auto;
    }

    .doc-title {
      border-bottom: 1px solid #dcdee0;
      font-size: 22px;
      margin: 8px 0 0;
      padding-bottom: 16px;
    }

    .doc-content h3 {
      font-size: 24px;
      font-weight: 600;
      margin: 24px 0;
    }

    .doc-content h4 {
      font-size: 22px;
      font-weight: 500;
      margin: 30px 0 8px;
    }

    .doc-content h4 span {
      color: #007d9c;
    }

    .doc-content .doc-declare {
      background-color: #fafafa;
      border-radius: 5px;
      border: 1px solid #ccc;
      font-size: 14px;
      overflow-x: auto;
      padding: 10px;
      tab-size: 4;
      line-height: 20px;
    }

    .doc-content .doc-comment {
      font-size: 16px;
      margin: 16px 0;
      line-height: 24px;
      word-break: break-word;
    }
  </style>

</head>
<body>
  <div class="container">
    <div class="doc-nav">
      <a href="#Documentation" class="nav-header">Documentation</a>
      <nav class="nav-content">
        <ul class="nav-list">
          <li>
            <a href="#includes" class="nav-label">Includes</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#tuya_cloud_types.h" class="nav-sub-label">tuya_cloud_types.h</a>
              </li>
      

              <li>
                <a href="#ty_cJSON.h" class="nav-sub-label">ty_cJSON.h</a>
              </li>
      

              <li>
                <a href="#gw_intf.h" class="nav-sub-label">gw_intf.h</a>
              </li>
      

              <li>
                <a href="#http_inf.h" class="nav-sub-label">http_inf.h</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#macros" class="nav-label">Macros</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#_IOT_HTTPC_H" class="nav-sub-label">_IOT_HTTPC_H</a>
              </li>
      

              <li>
                <a href="#httpc_raw_get(p_url, pp_raw_http, offset, total_len)" class="nav-sub-label">httpc_raw_get(p_url, pp_raw_http, offset, total_len)</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#functions" class="nav-label">Functions</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#httpc_common_post_no_remalloc" class="nav-sub-label">httpc_common_post_no_remalloc</a>
              </li>
      

              <li>
                <a href="#httpc_common_post" class="nav-sub-label">httpc_common_post</a>
              </li>
      

              <li>
                <a href="#http_gw_get_timer_cnt" class="nav-sub-label">http_gw_get_timer_cnt</a>
              </li>
      

              <li>
                <a href="#http_gw_get_timer_content" class="nav-sub-label">http_gw_get_timer_content</a>
              </li>
      

              <li>
                <a href="#httpc_gw_extra_erro_code_tranfer" class="nav-sub-label">httpc_gw_extra_erro_code_tranfer</a>
              </li>
      

              <li>
                <a href="#http_gw_reset" class="nav-sub-label">http_gw_reset</a>
              </li>
      

              <li>
                <a href="#http_iot_dns_get_cloud_url" class="nav-sub-label">http_iot_dns_get_cloud_url</a>
              </li>
      

              <li>
                <a href="#http_iot_dns_get_fast_cloud_url" class="nav-sub-label">http_iot_dns_get_fast_cloud_url</a>
              </li>
      

              <li>
                <a href="#http_iot_dns_cache_cloud_url" class="nav-sub-label">http_iot_dns_cache_cloud_url</a>
              </li>
      

              <li>
                <a href="#http_iot_dns_get_host_ip" class="nav-sub-label">http_iot_dns_get_host_ip</a>
              </li>
      

              <li>
                <a href="#http_gw_register_V41" class="nav-sub-label">http_gw_register_V41</a>
              </li>
      

              <li>
                <a href="#http_gw_active_v41" class="nav-sub-label">http_gw_active_v41</a>
              </li>
      

              <li>
                <a href="#http_gw_active_mesh" class="nav-sub-label">http_gw_active_mesh</a>
              </li>
      

              <li>
                <a href="#http_gw_update_version_v41" class="nav-sub-label">http_gw_update_version_v41</a>
              </li>
      

              <li>
                <a href="#http_ffs_pre_active" class="nav-sub-label">http_ffs_pre_active</a>
              </li>
      

              <li>
                <a href="#http_gw_download_file" class="nav-sub-label">http_gw_download_file</a>
              </li>
      

              <li>
                <a href="#wechat_gw_set_cloud_url" class="nav-sub-label">wechat_gw_set_cloud_url</a>
              </li>
      

              <li>
                <a href="#http_pskkey_get" class="nav-sub-label">http_pskkey_get</a>
              </li>
      

              <li>
                <a href="#http_put_rst_log" class="nav-sub-label">http_put_rst_log</a>
              </li>
      

              <li>
                <a href="#http_dynamic_cfg_get" class="nav-sub-label">http_dynamic_cfg_get</a>
              </li>
      

              <li>
                <a href="#http_dynamic_cfg_ack_v20" class="nav-sub-label">http_dynamic_cfg_ack_v20</a>
              </li>
      

              <li>
                <a href="#httpc_domain_certs_get" class="nav-sub-label">httpc_domain_certs_get</a>
              </li>
      

              <li>
                <a href="#http_put_cloud_config" class="nav-sub-label">http_put_cloud_config</a>
              </li>
      

              <li>
                <a href="#http_gw_property_save" class="nav-sub-label">http_gw_property_save</a>
              </li>
      

              <li>
                <a href="#http_gw_dev_sync_check" class="nav-sub-label">http_gw_dev_sync_check</a>
              </li>
      

              <li>
                <a href="#http_gw_dev_sync_proc" class="nav-sub-label">http_gw_dev_sync_proc</a>
              </li>
      

              <li>
                <a href="#http_secure_verify_v20" class="nav-sub-label">http_secure_verify_v20</a>
              </li>
      

              <li>
                <a href="#httpc_iot_certificate_get_v10" class="nav-sub-label">httpc_iot_certificate_get_v10</a>
              </li>
      

              <li>
                <a href="#httpc_iot_cloud_storage_encrypt_key_get" class="nav-sub-label">httpc_iot_cloud_storage_encrypt_key_get</a>
              </li>
      

              <li>
                <a href="#http_gw_custom_cfg_get" class="nav-sub-label">http_gw_custom_cfg_get</a>
              </li>
      

              <li>
                <a href="#http_gw_get_active_info" class="nav-sub-label">http_gw_get_active_info</a>
              </li>
      

              <li>
                <a href="#http_gw_location_info_get" class="nav-sub-label">http_gw_location_info_get</a>
              </li>
      

              <li>
                <a href="#httpc_raw_read_resp_header" class="nav-sub-label">httpc_raw_read_resp_header</a>
              </li>
      

              <li>
                <a href="#httpc_raw_read_content" class="nav-sub-label">httpc_raw_read_content</a>
              </li>
      

              <li>
                <a href="#httpc_raw_write_content" class="nav-sub-label">httpc_raw_write_content</a>
              </li>
      

              <li>
                <a href="#httpc_raw_close" class="nav-sub-label">httpc_raw_close</a>
              </li>
      

              <li>
                <a href="#httpc_raw_post" class="nav-sub-label">httpc_raw_post</a>
              </li>
      

              <li>
                <a href="#httpc_raw_get_with_head" class="nav-sub-label">httpc_raw_get_with_head</a>
              </li>
      

              <li>
                <a href="#httpc_raw_put" class="nav-sub-label">httpc_raw_put</a>
              </li>
      

              <li>
                <a href="#http_get_dev_token_create_v20" class="nav-sub-label">http_get_dev_token_create_v20</a>
              </li>
      

              <li>
                <a href="#http_active_url" class="nav-sub-label">http_active_url</a>
              </li>
      

              <li>
                <a href="#http_url" class="nav-sub-label">http_url</a>
              </li>
      

              <li>
                <a href="#httpc_active_shorturl_get" class="nav-sub-label">httpc_active_shorturl_get</a>
              </li>
      

              <li>
                <a href="#http_meta_rpt_v10" class="nav-sub-label">http_meta_rpt_v10</a>
              </li>
      

              <li>
                <a href="#http_ble_actived_enable_wifi" class="nav-sub-label">http_ble_actived_enable_wifi</a>
              </li>
      

              <li>
                <a href="#tuya_get_ble_beacon_key" class="nav-sub-label">tuya_get_ble_beacon_key</a>
              </li>
      

              <li>
                <a href="#http_iot_dns_get_host_ca" class="nav-sub-label">http_iot_dns_get_host_ca</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#vars" class="nav-label">Vars</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#consts" class="nav-label">Consts</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#types" class="nav-label">Types</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#typedefs" class="nav-label">Typedefs</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#HTTP_GW_GET_FILE_DATA_CB" class="nav-sub-label">HTTP_GW_GET_FILE_DATA_CB</a>
              </li>
      

              <li>
                <a href="#HTTP_DYNAMIC_CFG_TYPE;
" class="nav-sub-label">HTTP_DYNAMIC_CFG_TYPE;
</a>
              </li>
      

              <li>
                <a href="#DEV_SYNC_STATUS_E;
" class="nav-sub-label">DEV_SYNC_STATUS_E;
</a>
              </li>
      

              <li>
                <a href="#RAW_HTTP_S" class="nav-sub-label">RAW_HTTP_S</a>
              </li>
      

              <li>
                <a href="#DNS_QUERY_S;
" class="nav-sub-label">DNS_QUERY_S;
</a>
              </li>
      
            </ul>
            
          </li>
        </ul>
      </nav>
    </div>
    <div class="doc-content">
      <h2 id="Documentation" class="doc-title">Documentation</h2>
      <h3 id="includes">Includes</h3>
      

      <h4 id="tuya_cloud_types.h"><span>tuya_cloud_types.h</span></h4>
      <pre class="doc-declare"><code>#include "tuya_cloud_types.h"
</code></pre>
      <pre class="doc-comment">#include "tuya_cloud_types.h"
</pre>

      <h4 id="ty_cJSON.h"><span>ty_cJSON.h</span></h4>
      <pre class="doc-declare"><code>#include "ty_cJSON.h"
</code></pre>
      <pre class="doc-comment">#include "ty_cJSON.h"
</pre>

      <h4 id="gw_intf.h"><span>gw_intf.h</span></h4>
      <pre class="doc-declare"><code>#include "gw_intf.h"
</code></pre>
      <pre class="doc-comment">#include "gw_intf.h"
</pre>

      <h4 id="http_inf.h"><span>http_inf.h</span></h4>
      <pre class="doc-declare"><code>#include "http_inf.h"
</code></pre>
      <pre class="doc-comment">#include "http_inf.h"
</pre>
      <h3 id="macros">Macros</h3>
      

      <h4 id="_IOT_HTTPC_H">Marco <span>_IOT_HTTPC_H</span></h4>
      <pre class="doc-declare"><code>#define _IOT_HTTPC_H
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="httpc_raw_get(p_url, pp_raw_http, offset, total_len)">Marco <span>httpc_raw_get(p_url, pp_raw_http, offset, total_len)</span></h4>
      <pre class="doc-declare"><code>#define httpc_raw_get(p_url, pp_raw_http, offset, total_len) \
   httpc_raw_get_with_head(p_url, pp_raw_http, offset, total_len, NULL, NULL) \

</code></pre>
      <pre class="doc-comment">/**
 * @brief Raw HTTP GET request
 * 
 * @param[in] p_url URL to request
 * @param[in,out] pp_raw_http Pointer to RAW_HTTP_S
 * @param[in] offset Offset of buffer
 * @param[in] total_len Total length of buffer
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>
      <h3 id="functions">Functions</h3>
      

      <h4 id="httpc_common_post_no_remalloc">Func <span>httpc_common_post_no_remalloc</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_common_post_no_remalloc(IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN UINT_T data_total_len,IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result);</code></pre>
      <pre class="doc-comment">/**
 * @brief POST HTTP request without memory realloc
 * 
 * @param[in] api_name Name of API
 * @param[in] api_ver Version of API
 * @param[in] uuid UUID of device
 * @param[in] devid ID of device
 * @param[in] post_data Pointer to data
 * @param[in] data_total_len Length of data
 * @param[in] p_head_other Additional header to send
 * @param[out] pp_result Json encoded result
 * 
 * @note Caller ot this API shall ensure data buffer is bigger enough to include data padding
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_common_post">Func <span>httpc_common_post</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_common_post(IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result);</code></pre>
      <pre class="doc-comment">/**
 * @brief POST HTTP request
 * 
 * @param[in] api_name Name of API
 * @param[in] api_ver Version of API
 * @param[in] uuid UUID of device
 * @param[in] devid ID of device
 * @param[in] post_data Pointer to data
 * @param[in] p_head_other Additional header to send
 * @param[out] pp_result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_get_timer_cnt">Func <span>http_gw_get_timer_cnt</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_get_timer_cnt(IN CONST INT_T lastFetchTime, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Get the count of local timers
 * 
 * @param[in] lastFetchTime Last fetch time returned
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_get_timer_content">Func <span>http_gw_get_timer_content</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_get_timer_content(IN CONST INT_T offset, IN CONST INT_T limit, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Get content local timers
 * 
 * @param[in] offset Timer index
 * @param[in] limit Max count of timers
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_gw_extra_erro_code_tranfer">Func <span>httpc_gw_extra_erro_code_tranfer</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_gw_extra_erro_code_tranfer(char *ErroValu);</code></pre>
      <pre class="doc-comment">/**
 * @brief Transfer HTTP error string to error code
 * 
 * @param[in] ErroValu HTTP error state
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_reset">Func <span>http_gw_reset</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_reset(IN CONST GW_WORK_STAT_T stat);</code></pre>
      <pre class="doc-comment">/**
 * @brief Reset device
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_iot_dns_get_cloud_url">Func <span>http_iot_dns_get_cloud_url</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_iot_dns_get_cloud_url(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve URLs from TUYA IoT DNS service, device will use URLs to interact with
 * TUYA cloud later on
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_iot_dns_get_fast_cloud_url">Func <span>http_iot_dns_get_fast_cloud_url</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_iot_dns_get_fast_cloud_url(CHAR_T *env);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve special URLs from TUYA IoT DNS service, device will use URLs to interact with
 * TUYA cloud later on
 * 
 * @param[in] env Device runtime env
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_iot_dns_cache_cloud_url">Func <span>http_iot_dns_cache_cloud_url</span></h4>
      <pre class="doc-declare"><code>VOID http_iot_dns_cache_cloud_url(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Load URLs and related Ips of TUYA cloud to DNS cache
 *
 */</pre>

      <h4 id="http_iot_dns_get_host_ip">Func <span>http_iot_dns_get_host_ip</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_iot_dns_get_host_ip(IN CONST CHAR_T *domain, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Use TUYA IoT DNS service to translate domain to ip
 * 
 * @param[in] domain Domain name
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_register_V41">Func <span>http_gw_register_V41</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_register_V41(OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Register a device on TUYA cloud
 * 
 * @param[out] result Json encoded result
 * 
 * @note This API is deprecated
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_active_v41">Func <span>http_gw_active_v41</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_active_v41(OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Register and active a device on TUYA cloud
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_active_mesh">Func <span>http_gw_active_mesh</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_active_mesh(IN CONST CHAR_T *data, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Dynamic mesh gw Register and active a device on TUYA cloud
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_update_version_v41">Func <span>http_gw_update_version_v41</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_update_version_v41(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Update versions of device on TUYA cloud
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_ffs_pre_active">Func <span>http_ffs_pre_active</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_ffs_pre_active(IN CONST CHAR_T *wss_token, IN CONST CHAR_T*gw_endpoint);</code></pre>
      <pre class="doc-comment">/**
 * @brief Pre-active of FFS netcfg
 * 
 * @param[in] wss_token wss token
 * @param[in] gw_endpoint gateway endpoint
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_download_file">Func <span>http_gw_download_file</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_download_file(IN CONST CHAR_T *url,IN CONST UINT_T mlk_buf_len,\
                                 IN CONST HTTP_GW_GET_FILE_DATA_CB gfd_cb, IN PVOID_T priv_data, \
                                 IN CONST UINT_T total_len, IN CONST BYTE_T *p_key, IN CONST UINT_T key_len, INOUT BYTE_T file_hmac[32]);</code></pre>
      <pre class="doc-comment">/**
 * @brief Download file
 * 
 * @param[in] url URL of the file to download
 * @param[in] mlk_buf_len block size of dowload buffer
 * @param[in] gfd_cb Hander when download file
 * @param[in] priv_data Private data
 * @param[in] total_len Total length of file
 * @param[in] p_key HTTP decode key
 * @param[in] key_len Lenght od decode key
 * @param[in,out] file_hmac HMAC of download file
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="wechat_gw_set_cloud_url">Func <span>wechat_gw_set_cloud_url</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET wechat_gw_set_cloud_url(VOID);</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="http_pskkey_get">Func <span>http_pskkey_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_pskkey_get(OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve PSK key
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_put_rst_log">Func <span>http_put_rst_log</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_put_rst_log(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Upload information of device reset to TUYA cloud
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_dynamic_cfg_get">Func <span>http_dynamic_cfg_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_dynamic_cfg_get(IN CONST HTTP_DYNAMIC_CFG_TYPE type, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve dynamic config
 * 
 * @param[in] type Defined by HTTP_DYNAMIC_CFG_TYPE
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_dynamic_cfg_ack_v20">Func <span>http_dynamic_cfg_ack_v20</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_dynamic_cfg_ack_v20(IN CONST CHAR_T* timezone_ackId, IN CONST CHAR_T* rateRule_actId);</code></pre>
      <pre class="doc-comment">/**
 * @brief ACK of dynamic config(some configs need ack to ensure it is handled correctly)
 * 
 * @param[in] timezone_ackId ACK id of timezone
 * @param[in] rateRule_actId ACK id of dp rate rule
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_domain_certs_get">Func <span>httpc_domain_certs_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_domain_certs_get(OUT ty_cJSON **result, IN CONST CHAR_T *url_msg);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve certs of special domain
 * 
 * @param[in] url_msg Domain name to get certs
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_put_cloud_config">Func <span>http_put_cloud_config</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_put_cloud_config(IN CONST CHAR_T *data);</code></pre>
      <pre class="doc-comment">/**
 * @brief Upload config to TUYA cloud
 * 
 * @param[in] data Private data to upload
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_property_save">Func <span>http_gw_property_save</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_property_save(IN CONST CHAR_T *data);</code></pre>
      <pre class="doc-comment">/**
 * @brief Save property to TUYA cloud
 * 
 * @param[in] data Private data to upload
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_dev_sync_check">Func <span>http_gw_dev_sync_check</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_dev_sync_check(DEV_SYNC_STATUS_E *p_status);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve device status
 * 
 * @param[out] p_status Device status on TUYA cloud, defined by DEV_SYNC_STATUS_E
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_dev_sync_proc">Func <span>http_gw_dev_sync_proc</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_dev_sync_proc(VOID_T);</code></pre>
      <pre class="doc-comment">/**
 * @brief Sync device status
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_secure_verify_v20">Func <span>http_secure_verify_v20</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_secure_verify_v20(IN CONST CHAR_T *chipId, IN CONST CHAR_T *secureCode1, IN CONST CHAR_T *randomA, \
                IN CONST CHAR_T *token, IN CONST CHAR_T *region, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Verify secure chip status
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_iot_certificate_get_v10">Func <span>httpc_iot_certificate_get_v10</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_iot_certificate_get_v10(OUT cJSON **result,IN CONST CHAR_T *url_msg);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve certs of special domain
 * 
 * @param[in] url_msg Domain name to get certs
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_iot_cloud_storage_encrypt_key_get">Func <span>httpc_iot_cloud_storage_encrypt_key_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_iot_cloud_storage_encrypt_key_get(OUT cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve encrypt key of cloud storage
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_custom_cfg_get">Func <span>http_gw_custom_cfg_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_custom_cfg_get(IN CONST INT_T biztype, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve customized config
 * 
 * @param[in] biztype Customized key
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_get_active_info">Func <span>http_gw_get_active_info</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_get_active_info(OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Register and active a device on TUYA cloud
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_gw_location_info_get">Func <span>http_gw_location_info_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_gw_location_info_get(OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve location info
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_read_resp_header">Func <span>httpc_raw_read_resp_header</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_raw_read_resp_header(INOUT RAW_HTTP_S p_raw_http, OUT INT_T *p_status_code, OUT BOOL_T *p_chunked, OUT UINT_T *p_content_len);</code></pre>
      <pre class="doc-comment">/**
 * @brief Read header of raw HTTP respose
 * 
 * @param[in,out] pp_raw_http Pointer to RAW_HTTP_S
 * @param[out] p_status_code Status code from HTTP response
 * @param[out] p_chunked Data is chunk or not
 * @param[out] p_content_len Total length of response content
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_read_content">Func <span>httpc_raw_read_content</span></h4>
      <pre class="doc-declare"><code>INT_T httpc_raw_read_content(IN RAW_HTTP_S p_raw_http, IN BYTE_T *buf, IN CONST UINT_T buf_len);</code></pre>
      <pre class="doc-comment">/**
 * @brief Read content of raw HTTP response
 * 
 * @param[in] pp_raw_http Pointer to RAW_HTTP_S
 * @param[in] buf Pointer of data to write
 * @param[in] buf_len Length of buffer
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_write_content">Func <span>httpc_raw_write_content</span></h4>
      <pre class="doc-declare"><code>INT_T httpc_raw_write_content(IN RAW_HTTP_S p_raw_http, IN CONST BYTE_T *buf, IN CONST UINT_T buf_len, BOOL_T chunked);</code></pre>
      <pre class="doc-comment">/**
 * @brief Write raw HTTP request
 * 
 * @param[in] pp_raw_http Pointer to RAW_HTTP_S
 * @param[in] buf Pointer of data to write
 * @param[in] buf_len Length of buffer
 * @param[in] chunked Is chunk enabled
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_close">Func <span>httpc_raw_close</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_raw_close(IN RAW_HTTP_S p_raw_http);</code></pre>
      <pre class="doc-comment">/**
 * @brief Close raw HTTP request
 * 
 * @param[in] pp_raw_http Pointer to RAW_HTTP_S
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_post">Func <span>httpc_raw_post</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_raw_post(IN CONST CHAR_T *p_url, IN CONST UINT_T data_total_len, INOUT RAW_HTTP_S *pp_raw_http);</code></pre>
      <pre class="doc-comment">/**
 * @brief Raw HTTP POST request
 * 
 * @param[in] p_url URL to request
 * @param[in] data_total_len Total length of raw request
 * @param[in,out] pp_raw_http Pointer to RAW_HTTP_S
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_get_with_head">Func <span>httpc_raw_get_with_head</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_raw_get_with_head(IN CONST CHAR_T *p_url, INOUT RAW_HTTP_S *pp_raw_http,
                           IN UINT_T offset, IN UINT_T total_len,
                           IN HTTP_HEAD_ADD_CB add_head_cb,
                           IN VOID* add_head_data);</code></pre>
      <pre class="doc-comment">/**
 * @brief Raw HTTP GET request
 * 
 * @param[in] p_url URL to request
 * @param[in,out] pp_raw_http Pointer to RAW_HTTP_S
 * @param[in] offset Offset of buffer
 * @param[in] total_len Total length of buffer
 * @param[in] add_head_cb Hook before HTTP request sent, to add more HTTP header
 * @param[in] add_head_data Header data of add_head_cb
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="httpc_raw_put">Func <span>httpc_raw_put</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_raw_put(IN CONST CHAR_T *p_url, IN CONST UINT_T data_total_len, INOUT RAW_HTTP_S *pp_raw_http);</code></pre>
      <pre class="doc-comment">/**
 * @brief Raw HTTP PUT request
 * 
 * @param[in] p_url URL to request
 * @param[in] data_total_len Total length of raw request
 * @param[in,out] pp_raw_http Pointer to RAW_HTTP_S
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_get_dev_token_create_v20">Func <span>http_get_dev_token_create_v20</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_get_dev_token_create_v20(OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve token from cloud
 * 
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_active_url">Func <span>http_active_url</span></h4>
      <pre class="doc-declare"><code>CHAR_T *http_active_url(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve active HTTP url of TUYA cloud
 * 
 * @return NULL on error.
 */</pre>

      <h4 id="http_url">Func <span>http_url</span></h4>
      <pre class="doc-declare"><code>CHAR_T *http_url(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve active HTTP url of TUYA cloud
 * 
 * @return NULL on error.
 */</pre>

      <h4 id="httpc_active_shorturl_get">Func <span>httpc_active_shorturl_get</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET httpc_active_shorturl_get(char *uuid, char *appid, ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve short url of QR active
 * 
 * @param[in] uuid UUID of device
 * @param[in] appid ID of app
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_meta_rpt_v10">Func <span>http_meta_rpt_v10</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_meta_rpt_v10(VOID_T);</code></pre>
      <pre class="doc-comment">/**
 * @brief Meta rpt for fittings management
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="http_ble_actived_enable_wifi">Func <span>http_ble_actived_enable_wifi</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_ble_actived_enable_wifi(VOID);</code></pre>
      <pre class="doc-comment">/**
 * @brief Enalbe wifi after activated by BLE
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>

      <h4 id="tuya_get_ble_beacon_key">Func <span>tuya_get_ble_beacon_key</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET tuya_get_ble_beacon_key(OUT CHAR_T **beaconKey);</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="http_iot_dns_get_host_ca">Func <span>http_iot_dns_get_host_ca</span></h4>
      <pre class="doc-declare"><code>OPERATE_RET http_iot_dns_get_host_ca(IN DNS_QUERY_S *dns_arr, IN UINT_T arr_num, OUT ty_cJSON **result);</code></pre>
      <pre class="doc-comment">/**
 * @brief Retrieve IPs and Certs of specific domains
 * 
 * @param[in] dns_arr Array of domains
 * @param[in] arr_num Array size of domains
 * @param[out] result Json encoded result
 * 
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */</pre>
      <h3 id="vars">Vars</h3>
      
      <h3 id="consts">Consts</h3>
      
      <h3 id="types">Types</h3>
      
      <h3 id="typedefs">Typedefs</h3>
      

      <h4 id="HTTP_GW_GET_FILE_DATA_CB">Typedef <span>HTTP_GW_GET_FILE_DATA_CB</span></h4>
      <pre class="doc-declare"><code>typedef OPERATE_RET (*HTTP_GW_GET_FILE_DATA_CB)(IN PVOID_T priv_data, IN CONST UINT_T total_len,IN CONST UINT_T offset,\
                                           IN CONST BYTE_T *data,IN CONST UINT_T len,OUT UINT_T *remain_len);
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="HTTP_DYNAMIC_CFG_TYPE;
">Typedef <span>HTTP_DYNAMIC_CFG_TYPE;
</span></h4>
      <pre class="doc-declare"><code>typedef enum {
   /** all configs */
   HTTP_DYNAMIC_CFG_ALL,
   /** time zone */
   HTTP_DYNAMIC_CFG_TZ,
   /** rate rule for dp */
   HTTP_DYNAMIC_CFG_RATERULE,
} HTTP_DYNAMIC_CFG_TYPE;
</code></pre>
      <pre class="doc-comment">/**
 * @brief Definition of dynamic config
 */</pre>

      <h4 id="DEV_SYNC_STATUS_E;
">Typedef <span>DEV_SYNC_STATUS_E;
</span></h4>
      <pre class="doc-declare"><code>typedef enum {
   /** Unknown status */
   DEV_STATUS_UNKNOWN,
   /** Device need reset */
   DEV_STATUS_RESET,
   /** Device need refactory */
   DEV_STATUS_RESET_FACTORY,
   /** Device is normal */
   DEV_STATUS_ENABLE,
} DEV_SYNC_STATUS_E;
</code></pre>
      <pre class="doc-comment">/**
 * @brief Definition of status to check
 */</pre>

      <h4 id="RAW_HTTP_S">Typedef <span>RAW_HTTP_S</span></h4>
      <pre class="doc-declare"><code>typedef PVOID_T RAW_HTTP_S;
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="DNS_QUERY_S;
">Typedef <span>DNS_QUERY_S;
</span></h4>
      <pre class="doc-declare"><code>typedef struct
{
   /** Host name*/
   CHAR_T *host;
   /** Host port */
   INT_T port;
   /** is certs required */
   BOOL_T need_ca;
   /** is ip required */
   BOOL_T need_ip;
} DNS_QUERY_S;
</code></pre>
      <pre class="doc-comment">/**
 * @brief Definition of domain's IP and cert structure
 */</pre>
    </div>
  </body>
</html>
            